﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeihanLi.Common.Otp;

namespace fabao.Common.Entity
{
    public class AjaxResult
    {
        public AjaxResult(ResultType status, string message, object data,int total = 0)
        {
            this.status = status;
            this.message = message;
            this.data = data;
            this.total = total;
        }
        /// <summary>
        /// 结果类型。
        /// </summary>
        public ResultType status { get; set; }
        /// <summary>
        /// 消息内容。
        /// </summary>
        public string message { get; set; }
        /// <summary>
        /// 返回数据。
        /// </summary>
        public object data { get; set; }
        public int total { get; set; }
        public int code { get; set; } = 0;
    }

    public class AjaxDataListResult
    {
        public AjaxDataListResult(ResultType state, string message, object data = null, int count = 0, object oData = null)
        {
            this.code = state;
            this.msg = message;
            this.data = data;
            this.otherData = oData;
            this.count = count;
        }
        /// <summary>
        /// 结果类型。
        /// </summary>
        public object code { get; set; }
        /// <summary>
        /// 消息内容。
        /// </summary>
        public string msg { get; set; }
        /// <summary>
        /// 返回数据。
        /// </summary>
        public object data { get; set; }
        public object otherData { get; set; }
        public int count { get; set; }

    }
    /// <summary>
    /// 结果类型枚举。
    /// </summary>
    public enum ResultType
    {
        /// <summary>
        /// 消息。
        /// </summary>
        Info = 0,

        /// <summary>
        /// 成功。
        /// </summary>
        Success = 1,

        /// <summary>
        /// 异常。
        /// </summary>
        Error = -1,

        /// <summary>
        /// 警告。
        /// </summary>
        Warn = 2
    }
}
